﻿Imports System.Data.OleDb
Public Class AddNews
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btn_addNews_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_addNews.Click
        Dim sql As String = "INSERT INTO AddNews (AddedBy,Title, NewsBody)VALUES (@j1,@j2,@j3)"
        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("JamaicanConnectionString").ConnectionString)
        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)

        cmd.Parameters.AddWithValue("@j1", tb_addedby.Text)
        cmd.Parameters.AddWithValue("@j2", tb_newstitle.Text)
        cmd.Parameters.AddWithValue("@j3", tb_newsbody.Text)

        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
        cmd.Dispose()
        conn.Dispose()
    End Sub
End Class